package edu.neu.springcloud.service;

import edu.neu.springcloud.entity.Commodity;
import edu.neu.springcloud.entity.Factory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Service
//@FeignClient(value = "SPRINGCLOUD-PROVIDER-COMMODITY", fallbackFactory = CommodityClientServiceFallBackFactory.class)
@FeignClient(value = "SPRINGCLOUD-PROVIDER-FACTORY")
public interface FactoryClientService {

    @GetMapping("/factory/list")
    List<Factory> getAll(
            @RequestParam(value = "id", required = false) Long id,
            @RequestParam(value = "name", required = false) String name);

    @PostMapping("/factory/add")
    boolean add(@RequestBody Factory factory);

    @PostMapping("/factory/update/")
    boolean update(@RequestBody Factory factory);

    @GetMapping("/factory/delete/{id}")
    boolean delete(@PathVariable("id") Long id);
}
